package cn.njyd.corejava.thread.myday01;

public class MyThread04 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            for (int i=0;i<50;i++) {
                System.out.println(Thread.currentThread().getName() + "-" + i + "-");
            }
        },"线程1");
        t1.start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i=0;i<50;i++) {
                    System.out.println(Thread.currentThread().getName() + "-" + i + "-");
                }
            }
        },"线程2").start();
        for (int i=50;i<100;i++) {
            System.out.println(Thread.currentThread().getName()+"-"+i+"-");
        }
    }
}
